package com.ingeniouscamel.jsf2;

import java.util.ArrayList;
import java.util.List;

public class EmployeeService {
	private List<Employee> employees = new ArrayList<Employee>();

	public EmployeeService() {
		employees.add(new Employee("1", "Roberts", "Management"));
		employees.add(new Employee("2", "Bullock", "Management"));
		employees.add(new Employee("3", "Aniston", "Sales"));
		employees.add(new Employee("4", "Dench", "Sales"));
		employees.add(new Employee("5", "Winslet", "Sales"));
		employees.add(new Employee("6", "Kidman", "HR"));
	}

	public List<Employee> getAllEmployees() {
		return employees;
	}

	public List<Employee> getEmployeesByDept(String dept) {
		List<Employee> list = new ArrayList<Employee>();
		for (Employee e : employees) {
			if (e.getDept().equals(dept)) {
				list.add(e);
			}
		}
		return list;
	}
}
